Add configurable DNS removal delay in simulator#13302
Open
Ronitsabhaya75 wants to merge 2 commits into
Open
Conversation
Co-authored-by: Renish Patel <renishpatel2482001@gmail.com>
…-handling Resolve merge conflict in flow/Knobs.cpp by using buggify() for SIM_DNS_REMOVAL_MAX_DELAY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Currently in
sim2.cpp, when a simulated process dies, its DNS entry is immediately removed from the simulator's registry. While this works, it does not match real-world DNS caching/TTL behavior where stale records persist for a brief window. Because of this immediate cleanup, we miss out on simulating scenarios where clients attempt to connect to dead endpoints due to stale DNS information, which can hide bugs in our retry and connection recovery code.Solution
We introduced a configurable delay to DNS record removal in the simulator:
Flow Knob: Added
SIM_DNS_REMOVAL_MAX_DELAYinflow/Knobs. By default, this is0.0to preserve existing immediate-cleanup behavior. UnderBUGGIFY, it is set to a random delay in the range of[0.0, 2.0]seconds.Delayed Handler: Added
delayedRemoveIptoSimRegisteredHandlerContextinHTTPServer.cpp. It logs aSimDNSDelayedRemovaltrace event, fires a code probe, waits for the computed delay, and removes the registration.Sim2 Integration: Replaced the immediate removal call at
sim2.cpp:2228with the new delayed approach whenSIM_DNS_REMOVAL_MAX_DELAY > 0.Co-author Attribution:
Special thanks to Renish Patel (@Renish-patel ) for the design approach, particularly suggesting the use of
uncancellable()on the delayed future to prevent orphaned or leaked DNS entries if the parent actor is cancelled mid-wait.Testing Done